﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BasicFramework.Devices;
using BasicFramework.Services.MeshLoader.Meshes;
using BasicFramework.Services.MeshLoader.Nodes;
using SlimDX;
using System.IO;

namespace BasicFramework.Services.MeshLoader
{
    class MeshLoader : IMeshLoader
    {

        #region Fields


        #endregion


        #region Properties

        #endregion


        #region Constructors

        public MeshLoader(DeviceContextBase context)
        {
        }

        #endregion


        #region Events

        #endregion


        #region Methods

        public ColladaFile<T> LoadModel<T>(string fileName, Vector3 position, DeviceContextBase context) where T : DeviceContextBase
        {
            if (context == null)
            {
                // TODO : Exception Handling
                return null;
            }

            if (!File.Exists(fileName))
            {
                // TODO : Exception Handling
                return null;
            }

            FileInfo info = new FileInfo(fileName);

            if (!Path.HasExtension(fileName) || Path.GetExtension(fileName) != "dae")
            {
                Path.ChangeExtension(fileName, ".dae");
            }

            return new ColladaFile<T>(fileName, position, context);

        }

        #endregion

    }
}
